﻿using CanDichVu.FrameWork.Conrtron;
using CanDichVu.Service.Iservice;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CanDichVU.Controllers
{
    public class TinhThanhController : ContronllerBase
    {
        private readonly ITinhThanh _ITinhThanh;
        private readonly IQuanHuyen _IQuanHuyen;

        public TinhThanhController(ITinhThanh iTinhThanh, IQuanHuyen iQuanHuyen)
        {
            this._ITinhThanh = iTinhThanh;
            this._IQuanHuyen = iQuanHuyen;
        }
        //
        // GET: /TinhThanh/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult GetTinhThanhFooter()
        {
            var _listEntity = _ITinhThanh.getList();
            return PartialView("_GetTinhThanhFooter", _listEntity);
        }


        public ActionResult tinhthanh_show_more()
        {
            return PartialView("_tinhthanh_show_more");
        }

        public ActionResult ListTinhThanhByMaVung(string mavung)
        {
            var _listEntity = _ITinhThanh.getListByMaVung(mavung);
            return PartialView("_ListTinhThanhByMaVung", _listEntity);
        }

        public ActionResult TinhThanhDetails(int id, string name, int? page)
        {
            var entity = _ITinhThanh.GetById(id);
            if (page == null)
            {
                page = 1;
            }
            ViewBag.PageCurr = page;
            return View("TinhThanhDetails", entity);
        }

        public ActionResult QuanHuyenDetails(int cateID, int id, string name, int? page)
        {
            var entity = _IQuanHuyen.GetById(id);
            if (page == null)
            {
                page = 1;
            }
            ViewBag.PageCurr = page;
            return View("QuanHuyenDetails", entity);
        }

        public ActionResult _listSubDistric(int parentid)
        {
            var entity = _IQuanHuyen.getList(parentid);
            
            return PartialView("_listSubDistric", entity);
        }

    }
}
